home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / abc / FAQ / characters next >
Encoding:
Text File  |  1994-04-01  |  1.4 KB  |  42 lines  |  [TEXT/R*ch]

  1. HOW DO YOU DISPLAY NON-GRAPHIC CHARACTERS IN ABC?
  2.  
  3. One aim of ABC is that ABC programs should work identically on all
  4. machines: there are no references to machine or architectural features
  5. in the language.
  6.  
  7. Because different machines have different character sets, you can only
  8. directly represent ASCII characters in ABC programs, and only those
  9. characters have a guaranteed sorting.
  10.  
  11. To ensure portability, you have to do a bit of extra work to use other
  12. characters. The usual method is something like this:
  13.  
  14.         abc -i characters < characters-file
  15.  
  16. where characters-file is a file including (maybe as one line) all the
  17. characters you want to include.
  18.  
  19. This then creates an ABC location containing the characters you want
  20. to use.
  21.  
  22. If characters-file contains all the characters of your machine, spread
  23. over several lines, then you can do the following to find the minimum
  24. and maximum characters on your machine:
  25.  
  26.         PUT " ", " " IN minch, maxch
  27.         FOR line IN characters:
  28.             PUT min {minch; min line}, max {maxch; max line} IN minch, maxch
  29.  
  30. Now the list {minch..maxch} will contain all the characters.
  31.  
  32. Another, yet more portable, solution is to build a table mapping the names
  33. of the characters in some form to the characters themselves, and then
  34. use it like this:
  35.  
  36.         PUT char["TAB"] IN tab
  37.         PUT char["ESC"] IN esc
  38. and so on.
  39.  
  40. Beware! Character 0 is almost certain not to work, and will give odd
  41. results.
  42.